package com.fanqi.ipcapp.comparable;

import androidx.annotation.NonNull;

import java.util.Objects;

/**
 * Created by fanqi on 2020/6/11.
 * Description:用于复习comparable 和comparator的排序
 */
public class Employee {

    private int age;

    private String name;

    public int getAge() {
        return age;
    }

    public String getName() {
        return name;
    }

    public Employee(int age, String name) {
        this.age = age;
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Employee employee = (Employee) o;
        return age == employee.age &&
                Objects.equals(name, employee.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(age, name);
    }

    @NonNull
    @Override
    public String toString() {
        return "Employee{age=" + this.age + " name=" + this.name + "}";
    }
}
